const Setting = {
	state: {
		turnType: null, // 翻页方式
		fontSize: null, // 字体大小
		simplified: null, // 是否简体
		lineHeight: null, // 行高
		history: null, // 本书历史记录
		isDark: null, // 是否夜间模式
		colorType: null // 颜色值
	},
	getters: {
		get_turnType(state) {
			if (state.turnType) {
				return state.turnType
			}
			return uni.getStorageSync(`_turnType`)
		},
		get_fontSize(state) {
			if (state.fontSize) {
				return state.fontSize
			}
			return uni.getStorageSync(`_fontSize`)
		},
		get_simplified(state) {
			if (state.simplified) {
				return state.simplified
			}
			return uni.getStorageSync(`_simplified`)
		},
		get_lineHeight(state) {
			if (state.lineHeight) {
				return state.lineHeight
			}
			return uni.getStorageSync(`_lineHeight`)
		},
		get_history(state) {
			if (state.history) {
				return state.history
			}
			return uni.getStorageSync(`_history`)
		},
		get_isDark(state) {
			if (state.isDark) {
				return state.isDark
			}
			return uni.getStorageSync(`_isDark`)
		},
		get_colorType(state) {
			if (state.colorType) {
				return state.colorType
			}
			return uni.getStorageSync(`_colorType`)
		},
	},
	mutations: {
		set_turnType(state, turnType) {
			state.turnType = turnType
			uni.setStorageSync(`_turnType`, turnType)
		},
		set_fontSize(state, fontSize) {
			state.fontSize = fontSize
			uni.setStorageSync(`_fontSize`, fontSize)
		},
		set_simplified(state, simplified) {
			state.simplified = simplified
			uni.setStorageSync(`_simplified`, simplified)
		},
		set_lineHeight(state, lineHeight) {
			state.lineHeight = lineHeight
			uni.setStorageSync(`_lineHeight`, lineHeight)
		},
		set_history(state, history) {
			state.history = history
			uni.setStorageSync(`_history`, history)
		},
		set_isDark(state, isDark) {
			state.isDark = isDark
			uni.setStorageSync(`_isDark`, isDark)
		},
		set_colorType(state, colorType) {
			state.colorType = colorType
			uni.setStorageSync(`_colorType`, colorType)
		},
	}
}

export default Setting;
